package 力扣._8014_循环增长使字符串子序列等于另一个字符串;

class Solution3 {

    //大佬的
    public boolean canMakeSubsequence(String str1, String str2) {
        int j = 0;
        //双指针，依次检查str[i]或其增长后，是否是str2[j], 若是则j++
        for (int i = 0; i < str1.length() && j < str2.length(); i++) {
            j += str1.charAt(i) == str2.charAt(j) || (str1.charAt(i) - 'a' + 1) % 26 == str2.charAt(j) - 'a' ? 1 : 0;
        }
        return j == str2.length();
    }
}
